<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>联创首页</title>
    <link rel="stylesheet" href="/start/layui/css/layui.css">
    <link rel="stylesheet" href="/dist/style/css/reset.css">
    <link rel="stylesheet" href="/dist/style/css/login.css">
</head>
<body>
    <!-- 背景图片 -->
    <div class="loginBackground">
        <h2 class="loginTitle">联创EAM后台管理系统</h2>
        <div class="ManageDiv">
            <div class="loginformDiv">
                <span>账号登录</span>
                <div class="userName"></div>
                <input type="text" placeholder="请输入账号">
                <input class="PassWord" type="password" placeholder="请输入密码">
                <input class="Images" type="text" id="code_input" placeholder="请输入验证码">
                <div id="v_container"></div>
                <button class="btns">立即登录</button>
            </div>
        </div>
    </div>
</body>
</html>
<script src="https://code.jquery.com/jquery-3.4.1.min.js"></script>
<script src="/start/layui/layui.js"></script>
<script src="/start/layui/layui.all.js"></script>
<script src="../dist/js/gVerify.js"></script>
<script src="../dist/js/common.js"></script>
<script>
    var verifyCode = new GVerify("v_container");

    $('.btns').click(function () {
        var userName = $('input').eq(0).val()
        var password = $('input').eq(1).val()
        if (!userName.trim() || !password.trim()) return layer.alert("用户名或密码为空");
        var res = verifyCode.validate(document.getElementById("code_input").value);
        var params = {
            userName: userName,
            password: password
        }
        comment('/login/login.json', 'post', params, function (data) {
            if (data.code == 200) {
                location.href = 'http://127.0.0.1:5500/start/#/patrol/cash';
            } else {
                verifyCode.refresh()
                layer.alert("用户名或密码错误");
            }
        })


    })
</script>